package com.hawthorn.redis.initload;

import com.hawthorn.redis.service.user.UserCacheService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * <p>todo 初始化加载用户缓存</p>
 * @author: andyten@tom.com | xukaixing@hotmail.com
 * @created: 2021/12/8 9:49 AM
 * @version v1.0.1
 * @copyright: Copyright (c)  andyten
 */
@Component
@Slf4j
@Order(10)
public class InitLoadUserCache implements ApplicationRunner
{
  @Autowired
  UserCacheService userCacheService;

  @Override
  @Async("user2RedisExecutor")
  public void run(ApplicationArguments arg)
  {
    // 加载用户信息缓存
    userCacheService.init();
    // 加载用户角色信息缓存
  }

}
